﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImobitechDao;
using ImobitechModel.Facade;
using ImobitechModel.com.Constantes;

namespace ImobitechModel.com.Command
{    
    public class retornaPlano : Comando
    {
        public Object executar(IDictionary<string, string> values)
        {
            Plan plan = new Plan();
            int id = int.Parse(values.First(p => p.Key == NomeCampoConstantes.campo_planId).Value);
            AnuncioFacade anuncioFacade = AnuncioFacade.getInstance();
            Plan plano = (Plan)anuncioFacade.retornaPlano(id);

            IDictionary<string, string> planDictionary = new Dictionary<string, string>();
            planDictionary.Add(NomeCampoConstantes.campo_planName, plano.Name);
            planDictionary.Add(NomeCampoConstantes.campo_planValue, plano.Value.ToString());
            planDictionary.Add(NomeCampoConstantes.campo_planDateStart, plano.Date_Start.ToString("dd/MM/yyyy"));
            planDictionary.Add(NomeCampoConstantes.campo_planDateFinish, plano.Date_Finish.ToString("dd/MM/yyyy"));

            return planDictionary;
        }
    }
}
